/* Copyright Rex All rights reserved. */
enyo.kind({
	name: "com.RexToy.lengView",
	kind: com.RexToy.abstractCvtView,
	
	components: [
		{kind: "BasicScroller", components: [
			{kind: "RowGroup", components: [				
				{name: "m", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Meter")}
						]},
				{name: "km", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Kilometer")}
						]},
				{name: "sm", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Sea Mile")}
						]},
				{name: "mi", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Mile")}
						]},
				{name: "in", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Inch")}
						]},
				{name: "ft", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Feet")}
						]},
				{name: "li", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Li(China)")}
						]},
				{name: "zh", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Zhang(China)")}
						]},
				{name: "ch", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Chi(China)")}
						]}
			]}
		]}
      ],
	
	fomular: {
		"m->m": "m",		
		"m->km": "m/1000",
		"km->m": "km*1000",
		"m->sm": "m/1852",
		"sm->m": "sm*1852",
		"m->mi": "m/1609.344",
		"mi->m": "mi*1609.344",
		"m->in": "m*39.3701",
		"in->m": "in/39.3701",
		"m->ft": "m*3.2808",
		"ft->m": "ft/3.2808",		
		"m->li": "m/500",
		"li->m": "li*500",
		"m->zh": "m*0.3",
		"zh->m": "zh/0.3",
		"m->ch": "m*3",
		"ch->m": "ch/3"
	},
	
	units: ["m","km","sm","mi","in","ft","li","zh","ch"],
	baseUnit: "m",
	
	blur: function(sender)
	{
		if(this.isNumber(sender))
		{
			this.calc(sender.name, this.getNumber(sender));
		}
	}
});